/*
 * =====================================================================================
 * Copyright (C) 2024 Ingenic Semiconductor Co.,Ltd
 * All Rights Reserved
 *
 * Filename     : riscv_mailbox.c
 * Author       : Keven <keven.ywhan@ingenic.com>
 * Created      : 2024/06/18 17:26
 * Description  :
 *
 * =====================================================================================
 */
#include <FreeRTOS.h>
#include <task.h>
#include <completion.h>
#include <mutex.h>
#include <string.h>
#include <interrupt.h>
#include <i2c.h>
#include <message.h>
#include <mailbox.h>
#include "common/reg_riscv.h"

/* The baseops of mailbox */
void riscv_mailbox_sendmsg(uint32_t msg)
{
	uint32_t tmp = readl(RISCV_MBOX_TO_HOST);
	writel(msg | tmp, RISCV_MBOX_TO_HOST);
}

uint32_t riscv_mailbox_recvdmsg(void)
{
	uint32_t msg = readl(RISCV_MBOX_FROM_HOST);
	writel(0 , RISCV_MBOX_FROM_HOST);
	return msg;
}
